import App from './App.vue'
import { createApp } from 'vue'
//CSS
import './assets/css/color.css'
import './assets/css/style.css'
import './assets/css/fontawesome-free-5.15.4/css/all.min.css'
// 路由
import router from "@/router/index.js";
//持久化存储
import pinia from "./stores";
//element
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'


const app = createApp(App)
//eLement·pLus国际化
app.use(ElementPlus,{
    locale:zhCn,
})
for (const [key,component] of Object.entries(ElementPlusIconsVue)){
    app.component(key,component)
}
// 全局错误捕获
// app.config.errorHandler = (err, vm, info) => {
//     console.error('渲染错误:', err);
//     router.push({
//         path: '/error',
//         query: {
//             errorType: '500',
//             errorCode: '500',
//         }
//     }) // 跳转至预设错误页
//     return false;  // 阻止错误继续传播‌
// }
app.use(pinia)
app.config.globalProperties.$apiUsr = '/tp';
app.use(router).mount('#app')
